#!/bin/sh

# 获取 pnpm 的版本信息
PNPM_VERSION=$(pnpm --version | cut -d'.' -f1)
PNPM_VERSION_ALL=$(pnpm --version)

# 检查 pnpm 的版本是否为 9.x
if [ "$PNPM_VERSION" -ne 9 ]; then
  echo "\033[1;31mError: pnpm version must be 9.x, but found $PNPM_VERSION_ALL.\033[0m"
  echo "\033[1;33mPlease update pnpm by running:\033[0m"
  echo "\033[1;32mnpm install -g pnpm@9\033[0m"
  exit 1
fi

echo "\033[1;32mpnpm version is $PNPM_VERSION_ALL, proceeding with installation.\033[0m"